package com.starblink.brand.adapter

import android.view.ViewGroup
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
import com.starblink.android.basic.adapter.BaseBindingVH
import com.starblink.android.basic.adapter.BaseVH
import com.starblink.android.basic.ext.commContext
import com.starblink.android.basic.extension.dp2px
import com.starblink.android.basic.extension.navigationTo
import com.starblink.android.basic.util.post.CommonMutateManage
import com.starblink.basic.ext.load
import com.starblink.basic.route.RoutePage
import com.starblink.brand.bean.BrandRightBean
import com.starblink.brand.databinding.CellBrandRightBinding
import com.starblink.rocketreserver.fragment.ProductF

class BrandRightCell(
    private val pageElementValue:Int,
    private val mContext:FragmentActivity,
    parent: ViewGroup,
    itemHeightType: Int, //0-小卡片样式 1-大卡片样式
    private val getSearchTerm:(()->String?)?=null,
    private val onLoadMore:((position: Int)->Unit)?=null) :
    BaseVH<BrandRightBean>(BrandRightCardView(parent.context))  {
    private val cardView = itemView as BrandRightCardView
    init {
        cardView.setCardViewType(itemHeightType)
    }
    override fun onBind(model: BrandRightBean, position: Int) {
        cardView.bindModel(mContext,model,position,pageElementValue,getSearchTerm?.invoke())
        onLoadMore?.invoke(position)
    }
}